Skip to content

Add config to control MCP path appending to backend endpoint URL#14223

Merged
RakhithaRR merged 6 commits into
wso2:masterfrom
nisan-abeywickrama:master
Jul 3, 2026
Merged

Add config to control MCP path appending to backend endpoint URL#14223
RakhithaRR merged 6 commits into
wso2:masterfrom
nisan-abeywickrama:master

Conversation

@nisan-abeywickrama

Copy link
Copy Markdown
Contributor

Purpose

When the MCP path append feature flag is enabled, /mcp was unconditionally appended to MCP server backend endpoint URLs, causing 404 errors for MCP servers that don't expose a /mcp path segment. This change updates the Velocity templates to conditionally strip the URL postfix for MCP APIs based on the mcpPathAppended metadata flag.

Related issue: wso2/api-manager#5046

Approach

  • velocity_template.xml (all four distribution profiles: all-in-one-apim, api-control-plane, gateway, traffic-manager) — added a Velocity conditional block that removes the REST_URL_POSTFIX axis2 property for MCP APIs when $mcpPathAppended is not true. This ensures that when MCP path appending is disabled (the default), the gateway forwards requests to the backend URL as-is without appending /mcp.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: af0480ed-6418-49e5-870e-376f3134d365

📥 Commits

Reviewing files that changed from the base of the PR and between 7e360cc and a59c513.

📒 Files selected for processing (4)
  • all-in-one-apim/pom.xml
  • api-control-plane/pom.xml
  • gateway/pom.xml
  • traffic-manager/pom.xml
✅ Files skipped from review due to trivial changes (1)
  • traffic-manager/pom.xml

📝 Walkthrough

Walkthrough

Across four distribution module templates, MCP request handling now conditionally removes REST_URL_POSTFIX before McpMediator, the trailing endpoint_security placeholder is adjusted, MCPServerTestCase now uses /mcp in endpoint URLs, and carbon.apimgt.version is bumped in four POMs.

Changes

MCP path handling and test updates

Layer / File(s) Summary
Velocity templates: conditional REST_URL_POSTFIX removal
all-in-one-apim/.../velocity_template.xml, api-control-plane/.../velocity_template.xml, gateway/.../velocity_template.xml, traffic-manager/.../velocity_template.xml
Each template’s MCP inSequence now guards REST_URL_POSTFIX removal on mcpPathAppended != true before McpMediator.
Velocity templates: endpoint_security comment adjustment
all-in-one-apim/.../velocity_template.xml, api-control-plane/.../velocity_template.xml, gateway/.../velocity_template.xml, traffic-manager/.../velocity_template.xml
The trailing endpoint_security placeholder comment is adjusted or reinserted near the end of each template.
Integration tests: /mcp path in URLs
all-in-one-apim/.../mcp/MCPServerTestCase.java
The proxy request URL and default endpoint config URL now append /mcp to the host and port.
POM version bumps
all-in-one-apim/pom.xml, api-control-plane/pom.xml, gateway/pom.xml, traffic-manager/pom.xml
carbon.apimgt.version is updated from 9.33.141 to 9.33.145 in each module POM.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: chamilaadhi, tharindu1st, Arshardh, AnuGayan

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: controlling MCP path appending for backend endpoint URLs.
Description check ✅ Passed The description is directly aligned with the template changes and explains the MCP path append fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 8, 2026
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 9.44%. Comparing base (a3316d3) to head (a59c513).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #14223      +/-   ##
============================================
- Coverage      9.45%    9.44%   -0.01%     
  Complexity      785      785              
============================================
  Files           365      365              
  Lines         17839    17847       +8     
  Branches       1908     1909       +1     
============================================
  Hits           1686     1686              
- Misses        16126    16134       +8     
  Partials         27       27              
Flag Coverage Δ
integration_tests 9.44% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 8, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 22, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 1, 2026
@RakhithaRR RakhithaRR merged commit 05ae421 into wso2:master Jul 3, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants